home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / ping / pingform.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1999-02-12  |  20.6 KB  |  646 lines

  1. VERSION 5.00
  2. Object = "{41697034-C21B-11D2-ACDB-444553540000}#1.0#0"; "PING.OCX"
  3. Begin VB.Form PingForm 
  4.    Caption         =   "Ping ActiveX Control  Demo"
  5.    ClientHeight    =   6090
  6.    ClientLeft      =   60
  7.    ClientTop       =   375
  8.    ClientWidth     =   9420
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6090
  11.    ScaleWidth      =   9420
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin Ping_ActiveX_Control.Ping Ping1 
  14.       Left            =   4680
  15.       Top             =   840
  16.       _ExtentX        =   529
  17.       _ExtentY        =   529
  18.    End
  19.    Begin VB.TextBox RoundTripTimeText 
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   8.25
  23.          Charset         =   0
  24.          Weight          =   700
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   375
  30.       Left            =   8400
  31.       TabIndex        =   27
  32.       Top             =   1800
  33.       Width           =   855
  34.    End
  35.    Begin VB.TextBox LastIPScan 
  36.       BackColor       =   &H00E0E0E0&
  37.       BeginProperty Font 
  38.          Name            =   "MS Sans Serif"
  39.          Size            =   8.25
  40.          Charset         =   0
  41.          Weight          =   700
  42.          Underline       =   0   'False
  43.          Italic          =   0   'False
  44.          Strikethrough   =   0   'False
  45.       EndProperty
  46.       Height          =   375
  47.       Left            =   8640
  48.       TabIndex        =   25
  49.       Top             =   5400
  50.       Width           =   495
  51.    End
  52.    Begin VB.TextBox Text2 
  53.       BackColor       =   &H00E0E0E0&
  54.       BeginProperty Font 
  55.          Name            =   "MS Sans Serif"
  56.          Size            =   8.25
  57.          Charset         =   0
  58.          Weight          =   700
  59.          Underline       =   0   'False
  60.          Italic          =   0   'False
  61.          Strikethrough   =   0   'False
  62.       EndProperty
  63.       Height          =   375
  64.       Left            =   7440
  65.       TabIndex        =   24
  66.       Text            =   "202.159.32."
  67.       Top             =   5400
  68.       Width           =   1215
  69.    End
  70.    Begin VB.TextBox Text1 
  71.       BackColor       =   &H00E0E0E0&
  72.       BeginProperty Font 
  73.          Name            =   "MS Sans Serif"
  74.          Size            =   8.25
  75.          Charset         =   0
  76.          Weight          =   700
  77.          Underline       =   0   'False
  78.          Italic          =   0   'False
  79.          Strikethrough   =   0   'False
  80.       EndProperty
  81.       Height          =   375
  82.       Left            =   3240
  83.       TabIndex        =   22
  84.       Text            =   "202.159.32."
  85.       Top             =   4680
  86.       Width           =   1215
  87.    End
  88.    Begin VB.ListBox UserList 
  89.       Height          =   1815
  90.       Left            =   6000
  91.       TabIndex        =   21
  92.       Top             =   3360
  93.       Width           =   3255
  94.    End
  95.    Begin VB.CommandButton ScanCommand 
  96.       Caption         =   "Scan"
  97.       BeginProperty Font 
  98.          Name            =   "MS Sans Serif"
  99.          Size            =   8.25
  100.          Charset         =   0
  101.          Weight          =   700
  102.          Underline       =   0   'False
  103.          Italic          =   0   'False
  104.          Strikethrough   =   0   'False
  105.       EndProperty
  106.       Height          =   495
  107.       Left            =   240
  108.       TabIndex        =   20
  109.       Top             =   5280
  110.       Width           =   5295
  111.    End
  112.    Begin VB.TextBox IPto 
  113.       BackColor       =   &H00E0E0E0&
  114.       BeginProperty Font 
  115.          Name            =   "MS Sans Serif"
  116.          Size            =   8.25
  117.          Charset         =   0
  118.          Weight          =   700
  119.          Underline       =   0   'False
  120.          Italic          =   0   'False
  121.          Strikethrough   =   0   'False
  122.       EndProperty
  123.       Height          =   375
  124.       Left            =   4680
  125.       TabIndex        =   19
  126.       Text            =   "159"
  127.       Top             =   4680
  128.       Width           =   495
  129.    End
  130.    Begin VB.TextBox IPfrom 
  131.       BackColor       =   &H00E0E0E0&
  132.       BeginProperty Font 
  133.          Name            =   "MS Sans Serif"
  134.          Size            =   8.25
  135.          Charset         =   0
  136.          Weight          =   700
  137.          Underline       =   0   'False
  138.          Italic          =   0   'False
  139.          Strikethrough   =   0   'False
  140.       EndProperty
  141.       Height          =   375
  142.       Left            =   1920
  143.       TabIndex        =   17
  144.       Text            =   "2"
  145.       Top             =   4680
  146.       Width           =   495
  147.    End
  148.    Begin VB.TextBox IP 
  149.       BackColor       =   &H00E0E0E0&
  150.       BeginProperty Font 
  151.          Name            =   "MS Sans Serif"
  152.          Size            =   8.25
  153.          Charset         =   0
  154.          Weight          =   700
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       Height          =   375
  160.       Left            =   480
  161.       TabIndex        =   16
  162.       Text            =   "202.159.32."
  163.       Top             =   4680
  164.       Width           =   1215
  165.    End
  166.    Begin VB.TextBox EchoDataText 
  167.       BeginProperty Font 
  168.          Name            =   "MS Sans Serif"
  169.          Size            =   8.25
  170.          Charset         =   0
  171.          Weight          =   700
  172.          Underline       =   0   'False
  173.          Italic          =   0   'False
  174.          Strikethrough   =   0   'False
  175.       EndProperty
  176.       Height          =   375
  177.       Left            =   8400
  178.       TabIndex        =   13
  179.       Top             =   1440
  180.       Width           =   855
  181.    End
  182.    Begin VB.TextBox DataSizeText 
  183.       BeginProperty Font 
  184.          Name            =   "MS Sans Serif"
  185.          Size            =   8.25
  186.          Charset         =   0
  187.          Weight          =   700
  188.          Underline       =   0   'False
  189.          Italic          =   0   'False
  190.          Strikethrough   =   0   'False
  191.       EndProperty
  192.       Height          =   375
  193.       Left            =   8400
  194.       TabIndex        =   12
  195.       Top             =   1080
  196.       Width           =   855
  197.    End
  198.    Begin VB.TextBox PingingDataText 
  199.       BeginProperty Font 
  200.          Name            =   "MS Sans Serif"
  201.          Size            =   8.25
  202.          Charset         =   0
  203.          Weight          =   700
  204.          Underline       =   0   'False
  205.          Italic          =   0   'False
  206.          Strikethrough   =   0   'False
  207.       EndProperty
  208.       Height          =   375
  209.       Left            =   8400
  210.       TabIndex        =   11
  211.       Top             =   720
  212.       Width           =   855
  213.    End
  214.    Begin VB.TextBox TimeOutText 
  215.       BeginProperty Font 
  216.          Name            =   "MS Sans Serif"
  217.          Size            =   8.25
  218.          Charset         =   0
  219.          Weight          =   700
  220.          Underline       =   0   'False
  221.          Italic          =   0   'False
  222.          Strikethrough   =   0   'False
  223.       EndProperty
  224.       Height          =   375
  225.       Left            =   8400
  226.       TabIndex        =   10
  227.       Top             =   360
  228.       Width           =   855
  229.    End
  230.    Begin VB.CommandButton StopCommand 
  231.       Caption         =   "S  t  o  p"
  232.       BeginProperty Font 
  233.          Name            =   "MS Sans Serif"
  234.          Size            =   8.25
  235.          Charset         =   0
  236.          Weight          =   700
  237.          Underline       =   0   'False
  238.          Italic          =   0   'False
  239.          Strikethrough   =   0   'False
  240.       EndProperty
  241.       Height          =   735
  242.       Left            =   4320
  243.       TabIndex        =   4
  244.       Top             =   2880
  245.       Width           =   1455
  246.    End
  247.    Begin VB.TextBox HostIP 
  248.       BeginProperty Font 
  249.          Name            =   "MS Sans Serif"
  250.          Size            =   8.25
  251.          Charset         =   0
  252.          Weight          =   700
  253.          Underline       =   0   'False
  254.          Italic          =   0   'False
  255.          Strikethrough   =   0   'False
  256.       EndProperty
  257.       Height          =   375
  258.       Left            =   1800
  259.       TabIndex        =   3
  260.       Top             =   240
  261.       Width           =   3495
  262.    End
  263.    Begin VB.CommandButton PingCommand 
  264.       Caption         =   "Pinging Host"
  265.       BeginProperty Font 
  266.          Name            =   "MS Sans Serif"
  267.          Size            =   8.25
  268.          Charset         =   0
  269.          Weight          =   700
  270.          Underline       =   0   'False
  271.          Italic          =   0   'False
  272.          Strikethrough   =   0   'False
  273.       EndProperty
  274.       Height          =   735
  275.       Left            =   4320
  276.       TabIndex        =   2
  277.       Top             =   1560
  278.       Width           =   1455
  279.    End
  280.    Begin VB.TextBox StatusText 
  281.       Height          =   2415
  282.       Left            =   120
  283.       MultiLine       =   -1  'True
  284.       ScrollBars      =   3  'Both
  285.       TabIndex        =   0
  286.       Top             =   1440
  287.       Width           =   4095
  288.    End
  289.    Begin VB.Label Label13 
  290.       BorderStyle     =   1  'Fixed Single
  291.       Caption         =   " Scanning "
  292.       BeginProperty Font 
  293.          Name            =   "MS Sans Serif"
  294.          Size            =   8.25
  295.          Charset         =   0
  296.          Weight          =   700
  297.          Underline       =   0   'False
  298.          Italic          =   0   'False
  299.          Strikethrough   =   0   'False
  300.       EndProperty
  301.       Height          =   375
  302.       Left            =   6240
  303.       TabIndex        =   29
  304.       Top             =   5400
  305.       Width           =   1215
  306.    End
  307.    Begin VB.Label Label8 
  308.       BorderStyle     =   1  'Fixed Single
  309.       Caption         =   " Date Size, Echo Data, Round Trip Time are READ ONLY"
  310.       BeginProperty Font 
  311.          Name            =   "MS Sans Serif"
  312.          Size            =   8.25
  313.          Charset         =   0
  314.          Weight          =   700
  315.          Underline       =   0   'False
  316.          Italic          =   0   'False
  317.          Strikethrough   =   0   'False
  318.       EndProperty
  319.       Height          =   495
  320.       Left            =   6240
  321.       TabIndex        =   28
  322.       Top             =   2280
  323.       Width           =   3015
  324.    End
  325.    Begin VB.Label Label2 
  326.       BorderStyle     =   1  'Fixed Single
  327.       Caption         =   " Round Trip Time"
  328.       BeginProperty Font 
  329.          Name            =   "MS Sans Serif"
  330.          Size            =   8.25
  331.          Charset         =   0
  332.          Weight          =   700
  333.          Underline       =   0   'False
  334.          Italic          =   0   'False
  335.          Strikethrough   =   0   'False
  336.       EndProperty
  337.       Height          =   375
  338.       Left            =   6240
  339.       TabIndex        =   26
  340.       Top             =   1800
  341.       Width           =   2175
  342.    End
  343.    Begin VB.Label Label12 
  344.       Alignment       =   2  'Center
  345.       BackColor       =   &H00000000&
  346.       Caption         =   "List Of Active IP"
  347.       BeginProperty Font 
  348.          Name            =   "MS Sans Serif"
  349.          Size            =   9.75
  350.          Charset         =   0
  351.          Weight          =   700
  352.          Underline       =   0   'False
  353.          Italic          =   0   'False
  354.          Strikethrough   =   0   'False
  355.       EndProperty
  356.       ForeColor       =   &H0000FF00&
  357.       Height          =   255
  358.       Left            =   6000
  359.       TabIndex        =   23
  360.       Top             =   3120
  361.       Width           =   3255
  362.    End
  363.    Begin VB.Line Line7 
  364.       BorderColor     =   &H00E0E0E0&
  365.       X1              =   9360
  366.       X2              =   0
  367.       Y1              =   6000
  368.       Y2              =   6000
  369.    End
  370.    Begin VB.Line Line6 
  371.       X1              =   9360
  372.       X2              =   0
  373.       Y1              =   5880
  374.       Y2              =   5880
  375.    End
  376.    Begin VB.Line Line5 
  377.       X1              =   6000
  378.       X2              =   9480
  379.       Y1              =   2880
  380.       Y2              =   2880
  381.    End
  382.    Begin VB.Line Line2 
  383.       BorderColor     =   &H00E0E0E0&
  384.       X1              =   6000
  385.       X2              =   6000
  386.       Y1              =   0
  387.       Y2              =   2880
  388.    End
  389.    Begin VB.Line Line1 
  390.       X1              =   5880
  391.       X2              =   5880
  392.       Y1              =   0
  393.       Y2              =   3960
  394.    End
  395.    Begin VB.Label Label11 
  396.       Alignment       =   2  'Center
  397.       BorderStyle     =   1  'Fixed Single
  398.       Caption         =   "To  IP  Address :"
  399.       BeginProperty Font 
  400.          Name            =   "MS Sans Serif"
  401.          Size            =   8.25
  402.          Charset         =   0
  403.          Weight          =   700
  404.          Underline       =   0   'False
  405.          Italic          =   0   'False
  406.          Strikethrough   =   0   'False
  407.       EndProperty
  408.       Height          =   375
  409.       Left            =   3000
  410.       TabIndex        =   18
  411.       Top             =   4200
  412.       Width           =   2535
  413.    End
  414.    Begin VB.Label Label10 
  415.       Alignment       =   2  'Center
  416.       BorderStyle     =   1  'Fixed Single
  417.       Caption         =   "From  IP  Address :"
  418.       BeginProperty Font 
  419.          Name            =   "MS Sans Serif"
  420.          Size            =   8.25
  421.          Charset         =   0
  422.          Weight          =   700
  423.          Underline       =   0   'False
  424.          Italic          =   0   'False
  425.          Strikethrough   =   0   'False
  426.       EndProperty
  427.       Height          =   375
  428.       Left            =   240
  429.       TabIndex        =   15
  430.       Top             =   4200
  431.       Width           =   2535
  432.    End
  433.    Begin VB.Label Label9 
  434.       Alignment       =   2  'Center
  435.       BackColor       =   &H00000000&
  436.       Caption         =   "  Pinging Status "
  437.       BeginProperty Font 
  438.          Name            =   "MS Sans Serif"
  439.          Size            =   9.75
  440.          Charset         =   0
  441.          Weight          =   700
  442.          Underline       =   0   'False
  443.          Italic          =   0   'False
  444.          Strikethrough   =   0   'False
  445.       EndProperty
  446.       ForeColor       =   &H0000FF00&
  447.       Height          =   255
  448.       Left            =   1080
  449.       TabIndex        =   14
  450.       Top             =   1200
  451.       Width           =   2175
  452.    End
  453.    Begin VB.Label Label7 
  454.       BorderStyle     =   1  'Fixed Single
  455.       Caption         =   " Echo Data"
  456.       BeginProperty Font 
  457.          Name            =   "MS Sans Serif"
  458.          Size            =   8.25
  459.          Charset         =   0
  460.          Weight          =   700
  461.          Underline       =   0   'False
  462.          Italic          =   0   'False
  463.          Strikethrough   =   0   'False
  464.       EndProperty
  465.       Height          =   375
  466.       Left            =   6240
  467.       TabIndex        =   9
  468.       Top             =   1440
  469.       Width           =   2175
  470.    End
  471.    Begin VB.Label Label6 
  472.       BackColor       =   &H00000000&
  473.       Caption         =   "   Ping   Packet   Parameter"
  474.       BeginProperty Font 
  475.          Name            =   "MS Sans Serif"
  476.          Size            =   9.75
  477.          Charset         =   0
  478.          Weight          =   700
  479.          Underline       =   0   'False
  480.          Italic          =   0   'False
  481.          Strikethrough   =   0   'False
  482.       EndProperty
  483.       ForeColor       =   &H0000FF00&
  484.       Height          =   255
  485.       Left            =   6240
  486.       TabIndex        =   8
  487.       Top             =   120
  488.       Width           =   3015
  489.    End
  490.    Begin VB.Line Line3 
  491.       X1              =   0
  492.       X2              =   5880
  493.       Y1              =   3960
  494.       Y2              =   3960
  495.    End
  496.    Begin VB.Label Label5 
  497.       BorderStyle     =   1  'Fixed Single
  498.       Caption         =   " Time  Out  "
  499.       BeginProperty Font 
  500.          Name            =   "MS Sans Serif"
  501.          Size            =   8.25
  502.          Charset         =   0
  503.          Weight          =   700
  504.          Underline       =   0   'False
  505.          Italic          =   0   'False
  506.          Strikethrough   =   0   'False
  507.       EndProperty
  508.       Height          =   375
  509.       Left            =   6240
  510.       TabIndex        =   7
  511.       Top             =   360
  512.       Width           =   2175
  513.    End
  514.    Begin VB.Label Label4 
  515.       BorderStyle     =   1  'Fixed Single
  516.       Caption         =   " Pinging  Data   "
  517.       BeginProperty Font 
  518.          Name            =   "MS Sans Serif"
  519.          Size            =   8.25
  520.          Charset         =   0
  521.          Weight          =   700
  522.          Underline       =   0   'False
  523.          Italic          =   0   'False
  524.          Strikethrough   =   0   'False
  525.       EndProperty
  526.       Height          =   375
  527.       Left            =   6240
  528.       TabIndex        =   6
  529.       Top             =   720
  530.       Width           =   2175
  531.    End
  532.    Begin VB.Label Label3 
  533.       BorderStyle     =   1  'Fixed Single
  534.       Caption         =   " Data Size"
  535.       BeginProperty Font 
  536.          Name            =   "MS Sans Serif"
  537.          Size            =   8.25
  538.          Charset         =   0
  539.          Weight          =   700
  540.          Underline       =   0   'False
  541.          Italic          =   0   'False
  542.          Strikethrough   =   0   'False
  543.       EndProperty
  544.       Height          =   375
  545.       Left            =   6240
  546.       TabIndex        =   5
  547.       Top             =   1080
  548.       Width           =   2175
  549.    End
  550.    Begin VB.Label Label1 
  551.       BorderStyle     =   1  'Fixed Single
  552.       Caption         =   " Host IP Address :"
  553.       BeginProperty Font 
  554.          Name            =   "MS Sans Serif"
  555.          Size            =   8.25
  556.          Charset         =   0
  557.          Weight          =   700
  558.          Underline       =   0   'False
  559.          Italic          =   0   'False
  560.          Strikethrough   =   0   'False
  561.       EndProperty
  562.       Height          =   375
  563.       Left            =   120
  564.       TabIndex        =   1
  565.       Top             =   240
  566.       Width           =   1695
  567.    End
  568. Attribute VB_Name = "PingForm"
  569. Attribute VB_GlobalNameSpace = False
  570. Attribute VB_Creatable = False
  571. Attribute VB_PredeclaredId = True
  572. Attribute VB_Exposed = False
  573. Option Explicit
  574. Private Sub HostIP_Change()
  575.     Ping1.IPAddress = HostIP.Text
  576. End Sub
  577. Private Sub PingCommand_Click()
  578.     '
  579.     PingCommand.Enabled = False
  580.     Ping1.IPAddress = RTrim(HostIP.Text)
  581.     Ping1.PingHost = True
  582.     ' Sleep for a while
  583.     GoToSleep (Val(TimeOutText.Text))
  584.     If Ping1.Error Then
  585.         Ping1.PingHost = False
  586.         Exit Sub
  587.     End If
  588.     StatusText.Text = Ping1.PingingStatus
  589.     DataSizeText.Text = Str(Ping1.DataSize)
  590.     EchoDataText.Text = Ping1.EchoData
  591.     RoundTripTimeText.Text = Str(Ping1.RoundTripTime)
  592.     PingCommand.Enabled = True
  593.     Exit Sub
  594.     '
  595. End Sub
  596. Private Sub PingingDataText_Change()
  597.     Ping1.PingingData = PingingDataText.Text
  598. End Sub
  599. Private Sub ScanCommand_Click()
  600.     ScanCommand.Enabled = False
  601.     PingCommand.Enabled = False
  602.     Dim IPTest As Integer
  603.     StatusText.Text = ""
  604.     For IPTest = Val(IPfrom.Text) To Val(IPto.Text)
  605.         DoEvents
  606.         If ScanCommand.Enabled = True Then
  607.             Exit Sub
  608.         End If
  609.         Ping1.IPAddress = IP.Text & Str(IPTest)
  610.         Ping1.PingingData = Str(IPTest)
  611.         PingingDataText.Text = Str(IPTest)
  612.         LastIPScan.Text = Str(IPTest)
  613.         Ping1.PingHost = True
  614.         StatusText.Text = StatusText.Text + "Pinging to : " & IP.Text & Str(IPTest) + vbCrLf
  615.         StatusText.Text = StatusText.Text + Ping1.PingingStatus + vbCrLf
  616.         ' Sleep for a while
  617.         GoToSleep (Val(TimeOutText.Text))
  618.         ' If don't have error means the IP address is available
  619.         If Ping1.Error = False Then
  620.             ' To add the IP List...
  621.             ' Echo Data must be equal with Pinging Data
  622.             If Ping1.EchoData = Ping1.PingingData Then
  623.                 UserList.AddItem IP.Text & Str(IPTest)
  624.                 StatusText.Text = StatusText.Text + Ping1.PingingStatus + vbCrLf
  625.                 DataSizeText.Text = Str(Ping1.DataSize)
  626.                 EchoDataText.Text = Ping1.EchoData
  627.                 RoundTripTimeText.Text = Str(Ping1.RoundTripTime)
  628.             End If
  629.         Else
  630.             StatusText.Text = StatusText.Text + Ping1.PingingStatus + vbCrLf
  631.             Ping1.PingHost = False
  632.             Ping1.IPAddress = IP.Text & Str(IPTest + 1)
  633.         End If
  634.     Next IPTest
  635.     ScanCommand.Enabled = True
  636.     PingCommand.Enabled = True
  637. End Sub
  638. Private Sub StopCommand_Click()
  639.     Ping1.PingHost = False
  640.     ScanCommand.Enabled = True
  641.     PingCommand.Enabled = True
  642. End Sub
  643. Private Sub TimeOutText_Change()
  644.     Ping1.TimeOut = TimeOutText.Text
  645. End Sub
  646.